package com.juzi.timeanddate;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class SimpleDateFormatTest {
    public static void main(String[] args) throws ParseException {
        //1、开始，结束时间
        String startTime = "2021-11-11 00:00:00";
        String   endTime = "2021-11-11 00:10:00";

        //2、记录小贾 小皮时间
        String Jia = "2021-11-11 00:03:47";
        String  Pi = "2021-11-11 00:10:11";

        //3、解析时间
        SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
        Date d1 = sdf.parse(startTime);
        Date d2 = sdf.parse(endTime);
        Date d3 = sdf.parse(Jia);
        Date d4 = sdf.parse(Pi);

        if (d3.after(d1) && d3.before(d4)) {
            System.out.println("贾成功");
        }else{
            System.out.println("贾失败");
        }

        if (d4.after(d1) && d4.before(d4)) {
            System.out.println("皮成功");
        }else{
            System.out.println("皮失败");
        }
    }
}
